package icu.which.strongchild.common;

import lombok.Data;

import java.io.Serializable;

/**
 * 通用返回类
 *
 * @author which
 * @param <T>
 */
@Data
public class BaseResponse<T> implements Serializable {
    /**\
     * 响应码
     */
    private int code;
    /**
     * 数据
     */
    private T data;
    /**
     * 信息
     */
    private String message;

    public BaseResponse(int code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public BaseResponse(ErrorCode errorCode){
        this.code = errorCode.getCode();
        this.data = null;
        this.message = errorCode.getMessage();
    }

}
